<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html>
<head>
<link href="./css/modern.css" rel="stylesheet"> 
<link href="./css/style-student.css" rel="stylesheet" type="text/css">
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
</head>
<%@ page import="java.util.ArrayList"%>
<%@ page import="com.eece496.Helpers.GradesInfo"%>
	<%
		String firstname = (String) request.getAttribute("firstname");
		String lastname = (String) request.getAttribute("lastname");
		String isEmpty = (String) request.getAttribute("isEmpty");
		String courseNumber = (String) request.getAttribute("courseNumber");
		String sectionNumber = (String) request.getAttribute("sectionNumber");
		ArrayList<GradesInfo> GradesInfo = (ArrayList<GradesInfo>) request.getAttribute("GradesInfo");
	%>
<body>
<div id="container">
	<div id="header"><br>
		<h1 id="main-title"><b><font color = "000000">EECE Student Group Assessments</b></font></h1>
		<h2>Grades can be modified directly.  Make sure to click the "Submit" button at the bottom of the page!
			<a href="index.html">
			<p align="right"><font size = "5">Logout</font></p>
			</a>
		</h2>		
	</div>
    <div id="body" class="page-region-content tiles">
    		<form id=form method="post" action="ProfBackCoursePortalServlet">
             	<a href = "javascript:;" onclick="document.getElementById('form').submit();" class="back-button big page-back">
             		<input type = "hidden" name = "firstname" value = <%=firstname%>>
					<input type = "hidden" name = "lastname" value = <%=lastname%>>	
					<input type = "hidden" name = "courseNumber" value = "<%=courseNumber%>">
					<input type = "hidden" name = "sectionNumber" value = <%=sectionNumber%>>	
             	</a>
            </form>
    <div id="innerBody" class="page-region-content tiles">
    <h1><%=courseNumber%> Section <%=sectionNumber%> Grades</h1>
<form action="ProfEditGrades" id="myform" method="post">
<table cellspacing="0" cellpadding="0" border="0" width="325" class="striped" border=1>
  <tr>
    <td>
       <table cellspacing="0" cellpadding="1" border="0" width="300"class="striped" border=1 >
         <tr>
            <th></th>
         </tr>
       </table>
    </td>
  </tr>
  <tr>
    <td>
       <div style="100%; height:625px; width: 1000px; overflow:auto;">
         <table class="fixed" cellspacing="0" cellpadding="1" border="0" width="300" class="striped" border=1>
           <tr>
				<td><b>Student ID</b></td>
				<td><b>Student Name</b></td>
				<c:forEach items="${AssignmentInfo}" var="Info">
				<td><b><c:out value="${Info.name}" /></b></td>
				</c:forEach>
           </tr>
           <tr>
				<td></td>
				<td><b>Weight</b></td>
				<c:forEach items="${AssignmentInfo}" var="Info">
				<td><b><c:out value="${Info.weight}" /></b></td>
				</c:forEach>
           </tr>
 
          <c:forEach items="${GradesInfo}" var="gInfo">
           <tr>
				<td><c:out value="${gInfo.studentID}" /></td>
				<td><c:out value="${gInfo.firstName}" /> <c:out value="${gInfo.lastName}" /></td>
				 	<c:forEach items="${gInfo.grades}" var="grades">  
				 		<c:choose>
				 			<c:when test = "${grades == 'AB'}">
							<td><input type="text" name="Grades" value="${grades}" size="4" style="color: red; background-color: yellow;"></td>
							</c:when>
							<c:otherwise>
      						<td><input type="text" name="Grades" value="${grades}" size="4"></td>
      						</c:otherwise>
   					 	</c:choose>
					</c:forEach> 
           </tr>
           	</c:forEach>
         </table>  
       </div>
    </td>
  </tr>
</table>
<input type="hidden" name = "courseNumber" value = "<%=courseNumber%>">
<input type="hidden" name = "sectionNumber" value = "<%=sectionNumber%>">
<input type="submit" name = "button" value="Submit Changes"/>	
</form>
</div>
	</div>
		<div id="footer">
			&copy;UBC Electrical and Computer Engineering. Styled with <a
				href="http://metroui.org.ua">Metro UI CSS</a>
		</div>
</div>
</body>
</html>